import  Mock from 'mockjs'

/**
 *  1. 数据模拟
 *  2. ajax拦截
 * */

const  employee1 = Mock.mock({
    "id":1,
     "name":'@cname',
     "age":"@natural(20,40)"
})


const  attendance = Mock.mock({
     "list|5":[{
         "id|+1":1,
          "name":'@cname',
          "status|1":[
              {
                  id:1,
                   title:'出勤'
              },
              {
                  id:2,
                  title:'缺勤'
              }
          ]
     }]
})



const statuses = [
    {
        id:1,
        title:'出勤'
    },
    {
        id:2,
        title:'缺勤'
    }
]
/**
 *  ajax拦截规则
 * */
Mock.mock("http://test.org/emp",'get',employee1)

Mock.mock("http://test.org/attend",'get',attendance.list)

Mock.mock('http://test.org/status','get',statuses);